# -*- coding: utf-8 -*-
# @Time         : 12:36 2025/2/25
# @Author       : Chris
# @Description  :
from typing import Optional, List

from .product import ProductType, Industry, FlashSaleType
from .product_detail import AdventData, BookData
from .product_detail import BrandData, ChannelPV
from .product_detail import FoodData
from .product_detail import Image
from .product_detail import PublishShop
from .product_detail import ReportData, SkuImage
from .._models import BaseModel, NickedStrEnum


class SkuCreation(BaseModel):
    """SKU信息"""
    price: int
    """SKU售价（分）"""

    stock: int
    """SKU库存"""

    sku_text: str
    """SKU规格"""

    outer_id: Optional[str] = None
    """SKU商家编码"""


class AssumeRule(NickedStrEnum):
    """验货费规则"""
    BUYER = ("buyer", "买家承担")
    """买家承担"""

    SELLER = ("seller", "卖家承担")
    """卖家承担"""


class TradeRule(NickedStrEnum):
    """交易规则"""
    YHB_ONLY = ("yhbOnly", "仅支持验货宝")
    """仅支持验货宝"""

    YHB_OPTIONAL = ("yhbOptional", "支持验货宝")
    """支持验货宝"""


class InspectData(BaseModel):
    """验货宝信息, 商品类型为验货宝时必传

    验货宝信息
    """

    assume_rule: AssumeRule
    """验货费规则"""

    trade_rule: TradeRule
    """交易规则"""


class ProductCreationParams(BaseModel):
    """商品类目ID, 通过`查询商品类目`接口获取类目参数"""

    channel_cat_id: str
    """商品类目ID"""

    express_fee: int
    """运费（分）"""

    item_biz_type: ProductType
    """商品类型"""

    price: int
    """商品售价（分）, 注意：多规格商品时，必须是SKU其中一个金额"""

    publish_shop: List[PublishShop]
    """发布店铺"""

    sp_biz_type: Industry
    """商品行业"""

    stock: int
    """商品库存"""

    advent_data: Optional[AdventData] = None
    """闲鱼特卖信息, 闲鱼特卖类型为临期非食品行业时必传"""

    book_data: Optional[BookData] = None
    """图书信息"""

    brand_data: Optional[BrandData] = None
    """品牌捡漏信息"""

    channel_pv: Optional[List[ChannelPV]] = None
    """商品属性, 通过`查询商品属性`接口获取属性参数"""

    detail_images: Optional[List[Image]] = None
    """详情图片"""

    flash_sale_type: Optional[FlashSaleType] = None
    """闲鱼特卖类型"""

    food_data: Optional[FoodData] = None
    """食品信息"""

    inspect_data: Optional[InspectData] = None
    """验货宝信息, 商品类型为验货宝时必传"""

    original_price: Optional[int] = None
    """商品原价（分）, 注意：当商品类型是特卖类型，即`item_biz_type`=24时，`original_price`为必填"""

    outer_id: Optional[str] = None
    """商家编码, 注意：一个中文按2个字符算"""

    report_data: Optional[ReportData] = None
    """验货报告信息, 注意：已验货类型的商品按需必填"""

    sku_images: Optional[List[SkuImage]] = None
    """规格图片"""

    sku_items: Optional[List[SkuCreation]] = None
    """商品多规格信息"""

    stuff_status: Optional[int] = None
    """商品成色"""
